package com.lcredu.lcrsnack.commodity.controller;

import com.lcredu.lcrsnack.commodity.utils.FileUtil;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @author kirito
 * @create 2023-11-05 9:30
 */
@RestController
@RequestMapping("/file")
@CrossOrigin
public class FileController {
    @RequestMapping("upload")
    public String upload(MultipartFile file) throws IOException {
        String url = FileUtil.upload(file);
        return url;
    }
}
